package com.woniuxy.carrental.service.impl;

import com.woniuxy.carrental.entity.DateUtil;
import com.woniuxy.carrental.entity.Reporting;
import com.woniuxy.carrental.entity.Wareing;
import com.woniuxy.carrental.mapper.DetailsMapper;
import com.woniuxy.carrental.mapper.ReportingMapper;
import com.woniuxy.carrental.mapper.WareingMapper;
import com.woniuxy.carrental.service.ReportingService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author author
 * @create 2021-10-14 12:13
 */
@Service
public class ReportingServiceImpl implements ReportingService {


    @Resource
    ReportingMapper reportingMapper;

    @Resource
    WareingMapper wareingMapper;

    @Resource
    DetailsMapper detailsMapper;

    @Override
    public void addReportingService(Reporting reporting) {

        //添加定损订单
        reportingMapper.addReporting(reporting);
        //记录状态添加记录表单
        Wareing wareing = new Wareing();
        //数量
        wareing.setWareingcount(reporting.getReportingcount());
        //时间
        wareing.setWareingdata(DateUtil.data());
        //状态
        wareing.setWareingstate("定损");
        //名称
        wareing.setWareingname(detailsMapper.selectByIdOne(reporting.getDeid()).getDename());
        //id
        wareing.setWareingid(reporting.getReportingid());

        //记录状态
        wareingMapper.addWareing(wareing);

    }

}
